package com.xncoding.design.ZeRenLian.demo0;

/**
 * @title: GatewayHandler
 */
public abstract class GatewayHandler {
    /**
     * 执行下一个handler
     */
    protected GatewayHandler next;
    public void setNextGatewayHandler(GatewayHandler next) {
        this.next = next;
    }
    public GatewayHandler appendNext(GatewayHandler next) {
        this.next = next;
        return next;
    }

    //实现的handler 处理方案 强制必须实现
    public abstract void service();

    protected void nextService() {
        if (next != null) // 指向下一关
            next.service();
    }

}
